package com.gpzx.zx.module.home.ui.adapter;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.gpzx.zx.module.home.ui.fragment.InformationListFragment;

import java.util.List;


/**
 * 作者:吴奎庆
 * <p>
 * 时间:2019-12-21
 * <p>
 * 用途:
 */


public class QHPagerAdapter extends FragmentPagerAdapter {

    Context context;
    List<String> titleList;
    public QHPagerAdapter(Context context, @NonNull FragmentManager fm, List<String> titleList) {
        super(fm);
        this.context = context;
        this.titleList = titleList;
    }

    @NonNull
    @Override

    public Fragment getItem(int position) {

        Fragment fragment = InformationListFragment.Companion.newInstance(titleList.get(position));
//
//        switch (position) {
//            case 0:
//                fragment = InformationListFragment.Companion.newInstance(titleList.get(position));
//                break;
//            case 1:
//                fragment = InformationListFragment.Companion.newInstance(titleList.get(position));
//                break;
//            case 2:
//                fragment = InformationListFragment.Companion.newInstance(titleList.get(position));
//                break;
//            case 3:
//                fragment = InformationListFragment.Companion.newInstance(titleList.get(position));
//                break;
//            case 4:
//                fragment = InformationListFragment.Companion.newInstance(titleList.get(position));
//                break;
//            case 5:
//                fragment = InformationListFragment.Companion.newInstance(titleList.get(position));
//                break;
//        }

        return fragment;
    }

    @Override
    public int getCount() {
        return titleList.size();
    }
}
